using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MonsterCreator : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject monsterPrefab;
    void Start()
    {
        InvokeRepeating("Spawn", 1f, 1f);
    }

    // Update is called once per frame
    void Update()
    {
       

    }
    void Spawn()
    {
        GameObject newMonster = Instantiate(monsterPrefab);
        float randomX = Random.RandomRange(-20f, 20f);
        newMonster.transform.Translate(randomX, 0, 0);
    }
}
